<template>
	<view class="container">
		<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback">
			<block v-for="item in momentList" :key="item.moment_id"><moment-card :moment-object="item"></moment-card></block>
		</mescroll-body>
	</view>
</template>

<script>
import MescrollMixin from '@/components/mescroll-uni/mescroll-mixins.js';
import momentCard from '@/components/custom/moment-card.vue';
export default {
	mixins: [MescrollMixin], // 使用mixin
	components: { momentCard },
	data() {
		return {
			momentList: []
		};
	},
	methods: {
		upCallback(mescroll) {
			this.$u.api.getMomentList(mescroll.num).then(res => {
				const data = res.data.list;
				if (mescroll.num == 1) {
					this.momentList = data.data;
				} else {
					this.momentList.push(data.list);
				}
				this.mescroll.endBySize(data.data.length, data.total);
			});
		}
	}
};
</script>

<style></style>
